1. Field of the Invention
The present invention relates to a card storage medium such as an IC card, an optical card, etc. used as a cashless card, an ID card, a health management card, a local government service card, etc. More specifically, the present invention relates to a card-type storage medium having a multi-application support function enabling accesses from several applications to a file stored therein.
2. Description of the Related Art
An IC card (a card storage medium) 100 has, in general, a microprocessor unit (MPU) 101 and a storage (a file area; an EPROM/EEPROM, for example) 102 therein, and is connected to a transaction apparatus (an external apparatus), not shown, through a terminal unit 103, as shown in FIGS. 16 and 17.
The storage 102 has a data area in which data files are retained, and a directory area in which control information (pointers, etc.) about data files in the data area is retained. The MPU 101 manages the data files in the data area in the storage 102 on the basis of the control information in the directory area.
If the MPU 101 receives an access command through the terminal unit 103 from the external transaction apparatus, for example, the MPU 101 performs a read process (a read access), a write process (a write access), an erase process (an erase access), a rewrite process (a rewrite access) or the like on the storage 102 according to the access command.
In the MPU 101, there is provided a RAM 101B used as a work area when a control operation is performed, in addition to a RAM 101A for retaining a program used to perform the control operation. In the case of an IC card 100 of an ISO type, the terminal unit 103 has eight contacts (VCC, RST, CLS, RFU, GND, VPP, I/O, and RFU).
A communication control function and a command processing function known in the art in such an IC card 100 will be now described with reference to FIG. 18. When the IC card 100 is inserted into a R/W (a reader/writer, not shown) of the transaction apparatus such as a terminal, a hardware reset is first executed on the IC card 100, as shown at 1 in FIG. 18. In practice, a reset signal is inputted from a reset terminal (an RST contact of the terminal unit 103 in FIG. 17) of the IC card so that the MPU 101 is reset.
When the hardware reset is executed, the IC card 100 notifies an ATR (Answer To Reset) in response to that from a communication control unit 104 to the R/W (refer to 2 in FIG. 18). After that, the IC card 100 gets into a standby state where the IC card 100 waits for a reception of a command (a line interruptible state; refer to 3 in FIG. 18).
If receiving a command in this state (refer to 4 in FIG. 18), the IC card 100 gets into an interrupt disable state (a state in which the IC card 100 does not accept another command). The IC card 100 dispatches depending on the command received this time, and a command processing unit 105 performs a command process (refer to 5 in FIG. 18). After that, the IC card 100 notifies a response to the command to the R/W from the communication control unit 104 (refer to 6 in FIG. 18), then gets again into the standby state where the IC card 100 waits for a reception of a command (refer to 7 in FIG. 18).
Incidentally, an international standard by ISO in terms of an IC card is expected to be settled within 1995. For this, a system using an IC card has again aroused interest in recent years. A standard specification in terms of ways of using an IC card is now under investigation in many fields.
Concurrently, various ways of using the IC card are proposed with diversification and sophistication of users' demands. It is surmised that there are requirements for a system configuration enabling simultaneous accesses from plural applications to one IC card and establishment of a multi-application support function to realize such system configuration with an increase of the demands.
As having been described with reference to FIG. 18, the IC card 100 known in the art employs a synchronous half-duplex transmission system (a system in which, when the apparatus accepts a command in the standby state where the apparatus waits for a command, the apparatus does not accept another command until a process for the command is terminated and the apparatus returns to the standby state) as the communication control function. For this, the IC card 100 cannot receive a command in a state other than the standby state. If several commands occur asynchronously from several applications, the IC card 100 cannot comply with these commands. Moreover the function of the IC card 100 is insufficient to realize the multi-application support function.
Moreover, the IC card 100 known in the art is designed on the supposition that the IC card 100 receives an access from one application. In consequence, the IC card is provided with no exclusive function in an access control on files retained in the storage 102 of the IC card 100 to inhibit another access to a file while an access from an application is being accepted and the file is now in an open state.
In the case of accessing from several applications, if, while one application is accessing to an address on a file in the IC card 100, a demand for obtaining access to the same address occurs from the same application or anther application, there is a possibility of an occurrence of data conflict, as will be described later. To comply with this, the file access control requires an exclusive control function as described before. Since the IC card 100 known in the art does not have a support for the exclusive control function, the function of the IC card 100 is insufficient to realize the multi-application support function.
As described above, if a system in which accesses from several application occur is configured, the following problems arise since the IC card 100 has an insufficient function.
In a multi-application system, a command to the IC card 100 generally occurs asynchronously. There is, therefore, a case, for example, that the IC card 100 receives a command from an application A, then another application transmits a command to the IC card 100 while the IC card 100 is processing the former command, as shown in FIG. 19.
At this time, since the IC card 100 is in a line interrupt disable state as described before, the IC card 100 therefore ignores the command from the application B. As a result, the time of the application B runs out in a state where the application B is waiting for a response from the IC card 100.
If the time is out in a state where a response block is being waited, re-transmission of the command becomes necessary. In this case, the application B cannot discriminate whether the time-out occurs due to a hindrance on the side of the IC card 100 or the time-out occurs because the IC card 100 has ignored the command. To comply with this, it is possible that the applications A and B issue commands to the IC card 100 while watching states of other applications. If employing such a configuration, each of the applications A and B cannot process independently.
There is a case where, after the application A has altered data in a file of the IC card 100 from "C" to "D" in a state where the file is in an open state, the IC card 100 accepts a command to read the same address in the same file from the application B, as shown in FIG. 20, since the IC card 100 known in the art does not have an exclusive control function.
In such a case, the application B has read the data in consideration that the data "C" has been retained in that file, but the application B has actually notified the data "D" from the IC card 100 so that conflict has occurred in the data.